package com.geeke.test.entity;

import java.math.BigDecimal;
import java.util.List;

import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.geeke.sys.entity.User;
import com.geeke.wf.persistence.WfDataEntity;
import com.google.common.collect.Lists;

/**
 * 报销管理Entity
 * @author
 * @version
 */
public class Expense extends WfDataEntity<Expense> {

    private static final long serialVersionUID = 1382944834704343045L;

    private User applier; // 申请人

    private String name; // 名称

    private BigDecimal amount = new BigDecimal("0.00"); // 金额

    private List<ExpenseDetail> expenseDetailList = Lists.newArrayList(); // 子表列表

    // 构造方法
    public Expense() {
        super();
    }

    public Expense(String id) {
        super(id);
    }

    // 生成get和set方法

    @NotNull(message = "申请人不能为空")
    public User getApplier() {
        return applier;
    }

    public void setApplier(User applier) {
        this.applier = applier;
    }

    @Length(min = 1, max = 128, message = "名称长度必须介于 1 和 128 之间")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @NotNull(message = "金额不能为空")
    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public List<ExpenseDetail> getExpenseDetailList() {
        return expenseDetailList;
    }

    public void setExpenseDetailList(List<ExpenseDetail> expenseDetailList) {
        this.expenseDetailList = expenseDetailList;
    }

    /**
     * 获取实体对应表名
     */
    @Override
    @JsonIgnore
    public String getBusTableName() {
        return "test_expense";
    }

    /**
     * 获取实体对应Id
     */
    @Override
    @JsonIgnore
    public String getBusTableId() {
        return "1382944834704343045";
    }

    /**
     * 获取实体表中是否存在del_flag字段
     */
    @JsonIgnore
    public boolean getBusTableHasDelFlag() {
        return true;
    }
}
